<!DOCTYPE html>
<html>
<head>
    <meta charset='UTF-8'>
    <title>姓名案例-methods方法</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div  id="root">
        姓：<input type="text" v-model="xing"><br/><br/>
        名：<input type="text" v-model="ming"><br/><br/>
        姓名:<span>{{fullName()}}</span>
    </div>
</body>
<!--   JS   -->
    <script>
        new Vue({
            el:'#root',
            data:{
                xing:'王',
                ming:'漂亮'
            },
            methods:{
                fullName(){
                    return this.xing+this.ming
                }            
            },
        })
    </script>
</html>